home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / piblist.arc / NUMBER.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-03-21  |  2.3 KB  |  44 lines

  1. (*---------------------------------------------------------------------------*)
  2. (*              Number -- Pick up Number from PibList command line           *)
  3. (*---------------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Number( VAR n: REAL );
  6.  
  7. (*---------------------------------------------------------------------------*)
  8. (*                                                                           *)
  9. (*     Routine:  Number                                                      *)
  10. (*                                                                           *)
  11. (*     Purpose:  Pick up Number from PibList command line                    *)
  12. (*                                                                           *)
  13. (*     Calling Sequence:                                                     *)
  14. (*                                                                           *)
  15. (*        Number( VAR n: REAL );                                             *)
  16. (*                                                                           *)
  17. (*           n --- returned Number                                           *)
  18. (*                                                                           *)
  19. (*     Calls:    None                                                        *)
  20. (*                                                                           *)
  21. (*     Called By:   Display_Screen                                           *)
  22. (*                                                                           *)
  23. (*     Remarks:                                                              *)
  24. (*                                                                           *)
  25. (*        If the next character in the command line is not a digit, a 1 is   *)
  26. (*        returned as the value for 'n'.                                     *)
  27. (*                                                                           *)
  28. (*---------------------------------------------------------------------------*)
  29.  
  30. BEGIN (* Number *)
  31.  
  32.    IF NOT( command[cind] IN ['0'..'9'] ) THEN
  33.       n := 1.0
  34.    ELSE
  35.       BEGIN
  36.          n := 0.0;
  37.          REPEAT
  38.             n := 10.0 * n + ORD( command[cind] ) - ORD('0');
  39.             cind := cind + 1;
  40.          UNTIL NOT( command[cind] in ['0'..'9'] );
  41.       END;
  42.  
  43. END   (* Number *);
  44.